<?php
/**
 * @file party_sidebar.php
 * @author LD <2009-11-05 16:15:23>
 * @package notice
 * @desc
 *   房间活动
 */
require_once 'NoticeCore.class.php';
global $Options;

$query = "SELECT act_id as pid, act_name, room_id, room_name, status, DATE_FORMAT(`actioned`, '%y-%m-%d') as time FROM "
  .DB_NAME_ROOMS.".tbl_rooms_activity WHERE (( status IN ('1','5') )) ORDER BY `act_id` DESC LIMIT 0, 5";
$partyArr = NoticeCore::sql2Arrs($query);
//var_dump($partyArr);
if ( count($partyArr) > 0 ){
	
?>
<table width="669" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="6" height="29"><img src="images/topl.gif" width="6" height="29" /></td>
    <td align="center" background="images/topb.gif">
    <table width="96%" border="0" cellspacing="0" cellpadding="0">
        <tr><td align="left"><span class="blue14">房间最新活动</span></td>
          <td align="right"><a href="<?php echo $Options['partyUrl'] ?>"><img src="images/more2.gif" width="38" height="13" border="0" /></a></td>
        </tr>
    </table></td>
    <td width="6" height="29"><img src="images/topr.gif" width="6" height="29" /></td>
  </tr>
</table>

<table width="669" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="1" height="176" bgcolor="#a5bfeb"></td>
    <td align="center" valign="top">
	  <table width="80%" border="0" cellspacing="0" cellpadding="0"><tr><td height="8"></td></tr></table>
      <table width="654" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="233" align="left"><img src="images/hd.gif" width="224" height="168" /></td>
          <td width="421" valign="top">
          <table width="421" border="0" cellspacing="0" cellpadding="0">
			  <tr>
			    <td width="61" height="25" align="center" bgcolor="#c6e6fe" class="STYLE2">房间ID</td>
			    <td width="90" align="center" bgcolor="#c6e6fe" class="STYLE2">房间名称</td>
			    <td width="140" align="center" bgcolor="#c6e6fe" class="STYLE2">活动名称</td>
			    <td width="60" align="center" bgcolor="#c6e6fe" class="STYLE2">活动状态</td>
			    <td width="80" align="center" bgcolor="#c6e6fe" class="STYLE2">活动时间</td>
			  </tr>
		  </table>
<?php  
	foreach ($partyArr as $k => $v){
		if ( mb_strlen($v['room_name']) > 8 ){
			$v['room_nameS'] = mb_substr($v['room_name'], 0, 6, 'UTF-8');		
		}else $v['room_nameS'] = $v['room_name'];
		
		if ( mb_strlen($v['act_name']) > 12 ){
			$v['act_nameS'] = mb_substr($v['act_name'], 0, 10, 'UTF-8');		
		}else $v['act_nameS'] = $v['act_name'];

?>
<table width="421" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="61" height="28" align="center"><?php echo $v['room_id']; ?></td>
    <td width="110" align="center"><a href="notice/index.php?controller=party&action=view&pid=<?php echo $v['pid']; ?>" 
    	 title="<?php echo $v['room_name']; ?>"><?php echo $v['room_nameS']; ?></a></td>
    <td width="170" align="center"><a href="notice/index.php?controller=party&action=view&pid=<?php echo $v['pid']; ?>"  
    	 title="<?php echo $v['act_name']; ?>"><?php echo $v['act_nameS']; ?></a></td>
    
    <td width="80" align="center">
    <?php if ($v['status'] == '1'){
    		echo "<span style='color:blue;'>火热进行中</span>";	
    	  }else echo "<span style='color:green;'>圆满完成</span>"; ?>
    </td>
    <td width="80" align="center"><?php echo $v['time']; ?></td>
  </tr>
</table>
<?php } /* END foreach */ ?>        
            </td>
        </tr>
      </table></td>
    <td width="1" bgcolor="#a5bfeb"></td>
  </tr>
</table>
<table width="669" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="6" height="7"><img src="images/bl.gif" width="6" height="7" /></td>
    <td width="657" background="images/bbg.gif"><img src="images/bbg.gif" width="14" height="7" /></td>
    <td width="6" height="7"><img src="images/br.gif" width="6" height="7" /></td>
  </tr>
</table>
<table width="80%" border="0" cellspacing="0" cellpadding="0"><tr><td height="8"></td></tr></table>
<?php } /* END if */ ?>